package com.ruoyi.danny.listener;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.activiti.engine.delegate.Expression;


public class ReimEndStateListener implements ExecutionListener {
    private Expression status;

    @Override
    public void notify(DelegateExecution delegateExecution) {
//throw new RuntimeException("123");

        //获取购买的商品信息（远程调用商品微服务去获取商品信息） 发送http请求
        //java 发送http请求，使用apache httpclient
        // spring resttemplate  简洁
        ////String url = "http://localhost:10000/order/12";//硬编码ip和端口
        //String processInstanceBusinessKey = delegateExecution.getProcessInstanceBusinessKey();
        //String url = "http://localhost:9204/workflow/reim/list?pageNum=1&pageSize=10";  //硬编码服务名，通过下述的微服务集群就能看到轮询的效果
        //
        //RestTemplate restTemplate = new RestTemplate();
        //Object forObject = restTemplate.getForObject(url, Object.class);
        //System.out.println("============");
        //System.out.println(forObject);
        //System.out.println("============");
        //System.out.println("============");
        //System.out.println("============");
        //System.out.println("============");
        //System.out.println("============");
        //System.out.println("============");
        //System.out.println("============");
        //System.out.println("============");
        //System.out.println("============");
        //
        //
        //
        //RestTemplate bean = SpringUtils.getBean(RestTemplate.class);
        //Object forObject2 = bean.getForObject(url, Object.class);
        //System.out.println("============");
        //System.out.println(forObject2);
        //System.out.println("============");
        //System.out.println("============");
        //System.out.println("============");
        //System.out.println("============");
        //System.out.println("============");
        //System.out.println("============");

        //RestTemplate restTemplate = new RestTemplate();
        //restTemplate.getForObject(""., )
        //DanWorkflowReim workflowLeave = new DanWorkflowReim();

        //workflowLeave.setReimId(processInstanceBusinessKey);
        //workflowLeave.setStatus(Integer.parseInt(status.getValue(delegateExecution).toString()));
        //SpringUtils.getBean(IDanWorkflowReimService.class).updateDanWorkflowReim(workflowLeave);
    }
}
